/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package nx.behaviors;

import nx.behaviors.*;
import nx.utils.*;
import javaclient3.*;
import javaclient3.structures.*;

/**
 * Class implementing a Motor Schema (MS), used to always go in one direction.
 * Useful for cases where other behaviors generate turning vectors.
 * @author Alejandro Pustowka
 */
public class NxMSGoForward extends NxBehavior{

    /**
     * The Position2DInterface of the robot.
     */
    private Position2DInterface myPos;

    /**
     * Simple constructor.
     * @param name Name of the behavior.
     * @param myPos Position2DInterface of the robot.
     */
    public NxMSGoForward(String name, Position2DInterface myPos)
    {
        super(name);
        this.myPos = myPos;
    }

    /**
     * Output of this behavior. A vector directed towards the robot.
     * @return Vector Output.
     */
    public Vector2D value()
    {
        PlayerPose pos = myPos.getData().getPos();//.read(Position2d.READ_MODE_NO_WAIT);

        return new Vector2D(1,pos.getPa(),Vector2D.MODE_MA);

    }
}
